package com.example.fitnessapp.controller;

import com.example.fitnessapp.util.ApiResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/api/plan")
@RequiredArgsConstructor
public class PlanController {
    @GetMapping("/{userId}")
    public ApiResponse<Map<String, Object>> getPlan(@PathVariable String userId) {
        // TODO: 调用 Service 查询数据库
        Map<String, Object> plan = new HashMap<>();
        plan.put("planId", "p001");
        plan.put("userId", userId);
        plan.put("planName", "6月燃脂计划");
        plan.put("planDesc", "每天一万步");
        plan.put("startDate", "2024-06-01");
        plan.put("endDate", "2024-06-30");
        plan.put("targetDays", 20);
        plan.put("targetSteps", 10000);
        return ApiResponse.ok("success", plan);
    }

    @PostMapping
    public ApiResponse<Void> savePlan(@RequestBody Map<String, Object> req) {
        // TODO: 调用 Service 保存 / 更新
        return ApiResponse.ok("保存成功");
    }





}
